<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>试卷管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript" src="${path}/js/common/jquery.min.js"></script>
	<%--<script type="text/javascript" src="${path}/js/common/jquery.min.js"></script>--%>
	<script src="${path}/static/jquery-jbox/2.3/jquery.jBox-2.3.js"></script>
	<script src="${path}/static/jquery-jbox/2.3/jquery.jBox-2.3.src.js"></script>
	<script type="text/javascript" src="${path}/js/common/jquery.bootstrap-duallistbox.js"></script>

	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			console.log($("#inputForm"));
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});



		function t(i)
		{

			var cont = document.getElementById('container');
			if(i==1)
			{
				$("#stable").show();
				$("#random").hide();

			}else{
				$("#stable").hide();
				$("#random").show();

			}

		}

		function checkValidate()
		{
			var paperName=document.getElementById("paperName").value;
//			var paperAttribute=document.getElementById("paperAttribute").value;
//			var paperType =document.getElementById("paperType").value;
//			var duallist=document.getElementById("duallist").value;
			//判断是否为空
			if(paperName==null||paperName=="")
			{
				window.alertx("请输入试卷名称！");
				return false;
			}
			var radio =document.getElementById("duallist").value
			var checkbox =document.getElementById("checkboxDuallist").value
			var judement =document.getElementById("judementDuallist").value
			var shortAnswer =document.getElementById("shortAnswerDuallist").value
			var   radioScore = document.getElementById("score").value;
			var   checkboxScore = document.getElementById("score1").value;
			var   judementScore = document.getElementById("score2").value;
			var   shortAnswerScore = document.getElementById("score3").value;


			if(radio!=null && radio!="")
			{
				if(radioScore == "") {
					window.alertx("请输入单选题分值！");
					return false;
				}
			}
			if(checkbox!=null && checkbox!="")
			{
				if(checkboxScore == "") {
					window.alertx("请输入多选题分值！");
					return false;
				}
			}
			if(judement!=null && judement!="")
			{

				if(judementScore == "") {
					window.alertx("请输入判断题分值！");
					return false;
				}
			}
			if(shortAnswer!=null && shortAnswer!="")
			{

				if(shortAnswerScore == "") {
					window.alertx("请输入简答题分值！");
					return false;
				}
			}

		}

		function confirmQuestion(){
			$.ajax({
				type: "POST",
				url: "${ctx}/resource/resourceQuestion/getQuestionNameById",
				data: {
					"QuestionId": $('#duallist').val().toString()
				},
				success:function(QuestionListName){

					$('#questionBody').html("");

					var   score = document.getElementById("score").value;
					var va1 = document.getElementById("span1");
					if(score == ""){va1.innerHTML = "必填";va1.style.color='red';return false;}

					for(var i=0; i<QuestionListName.length; i++){
						var ty="";
						if(QuestionListName[i].type=="0"){ty = "单选题";}
						if(QuestionListName[i].type=="1"){ty = "多选题";}
						if(QuestionListName[i].type=="2"){ty = "判断题";}
						if(QuestionListName[i].type=="3"){ty = "简答题";}

						$("#questionBody").append("<tr> <td hidden>"+ QuestionListName[i].id +"</td><td>"+QuestionListName[i].name +"</td> <td>"+ty+"</td> <td>"+document.getElementById("score").value+"</td>" + "</tr>");
					}

				},
				error:function(){
					alertx("error");
				}
			});
		}

		function confirmQuestion1(){
			$.ajax({
				type: "POST",
				url: "${ctx}/resource/resourceQuestion/getQuestionNameById",
				data: {
					"QuestionId": $('#checkboxDuallist').val().toString()
				},
				success:function(QuestionListName){

					$('#questionBody1').html("");

					var   score1 = document.getElementById("score1").value;
					var va2 = document.getElementById("span2");
					if(score1 == ""){va2.innerHTML = "必填";va2.style.color='red';return false;}


					for(var i=0; i<QuestionListName.length; i++){
						var ty="";
						if(QuestionListName[i].type=="0"){ty = "单选题";}
						if(QuestionListName[i].type=="1"){ty = "多选题";}
						if(QuestionListName[i].type=="2"){ty = "判断题";}
						if(QuestionListName[i].type=="3"){ty = "简答题";}

						$("#questionBody1").append("<tr> <td hidden>"+ QuestionListName[i].id +"</td><td>"+QuestionListName[i].name +"</td> <td>"+ty+"</td> <td>"+document.getElementById("score1").value+"</td>" + "</tr>");
					}

				},
				error:function(){
					alertx("error");
				}
			});
		}

//		 判断题
		function confirmQuestion2(){

			$.ajax({
				type: "POST",
				url: "${ctx}/resource/resourceQuestion/getQuestionNameById",
				data: {
					"QuestionId": $('#judementDuallist').val().toString()
				},
				success:function(QuestionListName){

					$('#questionBody2').html("");

					var   score2 = document.getElementById("score2").value;
					var va3 = document.getElementById("span3");
					if(score2 == ""){va3.innerHTML = "必填";va3.style.color='red';return false;}


					for(var i=0; i<QuestionListName.length; i++){
						var ty="";
						if(QuestionListName[i].type=="0"){ty = "单选题";}
						if(QuestionListName[i].type=="1"){ty = "多选题";}
						if(QuestionListName[i].type=="2"){ty = "判断题";}
						if(QuestionListName[i].type=="3"){ty = "简答题";}

						$("#questionBody2").append("<tr> <td hidden>"+ QuestionListName[i].id +"</td><td>"+QuestionListName[i].name +"</td> <td>"+ty+"</td> <td>"+document.getElementById("score2").value+"</td>" + "</tr>");
					}

				},
				error:function(){
					alertx("error");
				}
			});
		}

//			简答题

		function confirmQuestion3(){

			$.ajax({
				type: "POST",
				url: "${ctx}/resource/resourceQuestion/getQuestionNameById",
				data: {
					"QuestionId": $('#shortAnswerDuallist').val().toString()
				},
				success:function(QuestionListName){

					$('#questionBody3').html("");

					var   score3 = document.getElementById("score3").value;
					var va4 = document.getElementById("span4");
					if(score3 == ""){va4.innerHTML = "必填";va4.style.color='red';return false;}


					for(var i=0; i<QuestionListName.length; i++){
						var ty="";
						if(QuestionListName[i].type=="0"){ty = "单选题";}
						if(QuestionListName[i].type=="1"){ty = "多选题";}
						if(QuestionListName[i].type=="2"){ty = "判断题";}
						if(QuestionListName[i].type=="3"){ty = "简答题";}

						$("#questionBody3").append("<tr> <td hidden>"+ QuestionListName[i].id +"</td><td>"+QuestionListName[i].name +"</td> <td>"+ty+"</td> <td>"+document.getElementById("score3").value+"</td>" + "</tr>");
					}

				},
				error:function(){
					alertx("error");
				}
			});
		}


		function selectAttribute(attribute){

			$.ajax({
				type: "POST",
				url: "${ctx}/resource/resourcePaper/findPaperListByAttribute",
				data: {
					attribute:attribute.options[attribute.selectedIndex].value
				},
				success:function(json){
					console.log("json单选selectAttribute"+json);
					$(".resetDuallist").empty();
					var list = json.dataObj;
					for(var i=0;i<list.length;i++)
					{

						$("#duallist").append("<option value='"+ list[i].id+"'>"+list[i].questionName+"</option>");
					}
					$(".resetDuallist").bootstrapDualListbox('refresh');
				},
				error:function(){
					alertx("error");
				}
			});
		}


		function Search(options,type){

//        alert(document.getElementById(type).checked)
//
			if(document.getElementById(type+"_options").checked){
		    var  a = document.getElementById(type + "_countNumber").value;
			var  repertoryId =	document.getElementById("repertoryId").value;
			var  difficulty =	document.getElementById(type + "_difficulty").value;
			$.ajax({
				type: "POST",
				url: "${ctx}/resource/resourcePaper/lists",
				data: {
					repertoryId:repertoryId,
					options:options,
					difficulty:difficulty,
					a:a
				},
				success: function (Class) {
					if(Class == 1){

//						alert("题库题目不够");
						$.jBox($("#importNumber").html(), {title: "", buttons: {"确定": true}});

						document.getElementById(type + "_countNumber").value="";
					}

				},
				error:function(){
					console.info("error");
				}
			});

                if(a != "") {
					document.getElementById(type + "_span2").innerHTML = "*";
					document.getElementById(type + "_span2").style.color = 'red';
				}else{
					document.getElementById(type + "_span2").innerHTML = "必填";
					document.getElementById(type + "_span2").style.color = 'red';
				}



			}else{
				$.jBox($("#importNumber2").html(), {title: "", buttons: {"确定": true}});

//				alert("先选择相对类型");

				document.getElementById(type + "_countNumber").value="";
			}
		}




		function myCheck()
		{

            var   radio_options = document.getElementById("radio_options").checked;
			var   checkbox_options = document.getElementById("checkbox_options").checked;;
			var   judement_options = document.getElementById("judement_options").checked;;
			var   shortAnswer_options = document.getElementById("shortAnswer_options").checked;;

			var   radio_score = document.getElementById("radio_score").value;
			var   checkbox_score = document.getElementById("checkbox_score").value;
			var   judement_score = document.getElementById("judement_score").value;
			var   shortAnswer_score = document.getElementById("shortAnswer_score").value;

			var   radio_countNumber = document.getElementById("radio_countNumber").value;
			var   checkbox_countNumber = document.getElementById("checkbox_countNumber").value;
			var   judement_countNumber = document.getElementById("judement_countNumber").value;
			var   shortAnswer_countNumber = document.getElementById("shortAnswer_countNumber").value;

			var va1 = document.getElementById("radio_span1");  var va2 = document.getElementById("radio_span2");
			var cs1 = document.getElementById("checkbox_span1");  var cs2 = document.getElementById("checkbox_span2");
			var js1 = document.getElementById("judement_span1");  var js2 = document.getElementById("judement_span2");
			var ss1 = document.getElementById("shortAnswer_span1");  var ss2 = document.getElementById("shortAnswer_span2");

			if(radio_options == true){
				if(radio_score == "" && radio_countNumber == ""){va1.innerHTML = "必填";va1.style.color='red';va2.innerHTML = "必填";va2.style.color='red';return false;}
				if(radio_score == ""){va1.innerHTML = "必填";va1.style.color='red';return false;}
				if(radio_countNumber == ""){va2.innerHTML = "必填";va2.style.color='red';return false;}
			}

			if(checkbox_options == true){
				if(checkbox_score == "" && checkbox_countNumber == ""){cs1.innerHTML = "必填";cs1.style.color='red';cs2.innerHTML = "必填";cs2.style.color='red';return false;}
				if(checkbox_score == ""){cs1.innerHTML = "必填";cs1.style.color='red';return false;}
				if(checkbox_countNumber == ""){cs2.innerHTML = "必填";cs2.style.color='red';return false;}
			}


			if(judement_options == true){
				if(judement_score == "" && judement_countNumber == ""){js1.innerHTML = "必填";js1.style.color='red';js2.innerHTML = "必填";js2.style.color='red';return false;}
				if(judement_score == ""){js1.innerHTML = "必填";js1.style.color='red';return false;}
				if(judement_countNumber == ""){js2.innerHTML = "必填";js2.style.color='red';return false;}
			}

			if(shortAnswer_options == true){
				if(shortAnswer_score == "" && shortAnswer_countNumber == ""){ss1.innerHTML = "必填";ss1.style.color='red';ss2.innerHTML = "必填";ss2.style.color='red';return false;}
				if(shortAnswer_score == ""){ss1.innerHTML = "必填";ss1.style.color='red';return false;}
				if(shortAnswer_countNumber == ""){ss2.innerHTML = "必填";ss2.style.color='red';return false;}
			}


		/*	if(shortAnswer_options == false && judement_options == false && checkbox_options == false && radio_options == false){
				alert("最少选择一个类型");
				return false;
			}*/




					return true;


		}


       function scoree(type){
		   var  a = document.getElementById(type + "_score").value;
		   if(a != "") {
			   document.getElementById(type + "_span1").innerHTML = "*";
			   document.getElementById(type + "_span1").style.color = 'red';
		   }else{
			   document.getElementById(type + "_span1").innerHTML = "必填";
			   document.getElementById(type + "_span1").style.color = 'red';
		   }
		}




	</script>

	<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="all">
	<%--<link rel="stylesheet" href="${path}/css/common/bootstrap.min.css" rel="stylesheet" type="text/css" media="all"/>--%>
	<link rel="stylesheet" href="${path}/css/common/bootstrap-duallistbox.css" rel="stylesheet" type="text/css"/>


	<style>
		.control-label{font-weight: normal;}
		#paperName{ height: 30px;}
		#score{ height: 30px;}
		#score1{ height: 30px;}
		#score2{ height: 30px;}
		#score3{ height: 30px;}
		#scoreLabel{font-weight: normal;}
		#scoreLabel1{font-weight: normal;}
		#scoreLabel2{font-weight: normal;}
		#scoreLabel3{font-weight: normal;}

		#importNumber1 {
			position: absolute;
			top: 35px;
			left: 10px;
		}

		#importNumber3 {
			position: absolute;
			top: 35px;
			left: 10px;
		}
	</style>
</head>
<body>

<div id="importNumber2" class="hide">
	<div id="importNumber3">先选择相对类型</div>
</div>
<div id="importNumber" class="hide">
	<div id="importNumber1">题目不足</div>
</div>

<ul class="nav nav-tabs">
		<li><a href="${ctx}/resource/resourcePaper/">试卷列表</a></li>
		<li class="active"><a href="${ctx}/resource/resourcePaper/form?id=${resourcePaper.id}">试卷<c:choose><c:when test="${not empty type}">复制</c:when><c:otherwise><shiro:hasPermission name="resource:resourcePaper:edit">${not empty resourcePaper.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="resource:resourcePaper:edit">查看</shiro:lacksPermission></c:otherwise></c:choose></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="resourcePaper" action="${ctx}/resource/resourcePaper/save" method="post" class="form-horizontal" onSubmit="return myCheck()">

		<form:hidden path="id"/>
		<input type="hidden" name="type" id="type" value="${type}">
			<sys:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">试卷名称：</label>
			<div class="controls">
				<form:input id="paperName" path="paperName" name="paperName" htmlEscape="false" maxlength="64" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">试卷属性：</label>
			<div class="controls">
				<select id="paperAttribute" name="paperAttribute" path="paperAttribute" class="input-xlarge required">
					<%--<form:option value="" label=""/>--%>
					<%--<form:options items="${fns:getDictList('resource_paper_attribute')}" itemLabel="label" itemValue="value" htmlEscape="false"/>--%>
						<c:choose>
							<c:when test="${isSuperAdmin=='false'}">
								<option value="0" selected>${fns:getDictLabel("0",'resource_paper_attribute',"无")}</option>
							</c:when>
							<c:otherwise>
								<c:forEach var="attribute" items="${fns:getDictList('resource_paper_attribute')}">
									<option value="${fns:getDictValue(attribute,'resource_paper_attribute',"")}" <c:if test="${fns:getDictValue(attribute,'resource_paper_attribute','')==resourcePaper.paperAttribute}">selected</c:if>>${attribute}</option>
								</c:forEach>
							</c:otherwise>
						</c:choose>
				</select>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">试卷类别：</label>
			<div class="controls">
				<input type="radio" id="paperType" name="paperType"  value="1"  onclick="t(1)" checked="checked"/>固定试卷
				<input type="radio" id="paperType" name="paperType" value="2" onclick="t(2)"/>随机试卷
				<%--<form:radiobuttons id="paperType" name="paperType" path="paperType" items="${fns:getDictList('resource_paper_type')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required" onchange="changetype()"/>--%>
				<%--<span class="help-inline"><font color="red">*</font> </span>--%>
			</div>
		</div>
		<div id="stable">


			<%--单选题--%>
		<div class="control-group">
			<label class="control-label">题目类型：</label>
			<div class="controls">
				<select  id="questionType" name="questionType" class="input-xlarge required" disabled="true">
					<c:forEach var="attribute" items="${fns:getDictList('resource_question_type')}">
						<option value="${fns:getDictValue(attribute,'resource_question_type',"")}" <c:if test="${fns:getDictValue(attribute,'resource_question_type','')==resourceQuestion.questionType}">selected</c:if>>${attribute}</option>
					</c:forEach>
				</select>

				<label id="scoreLabel">分值：</label>
				<input id="score" type="number" name="score" htmlEscape="false" maxlength="64" class="input-xlarge " value ="${radioScore.score}" />
				<span id="span1" class="help-inline"><font  color="red">*</font> </span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">选择题目：</label>
			<div class="controls">
				<div class="container"></div>
				<div class="col-lg-10 col-md-9 col-sm-9 col-xs-12" >
					<select  multiple="multiple" size="10" id="duallist" name="duallist" class="resetDuallist">
						<c:forEach var="resourceQuestion" items="${resourceQuestionRadios}" varStatus="status">
						<option value="${resourceQuestion.id}" <c:if test="${resourceQuestion.isChoose=='true'}">selected</c:if>>${resourceQuestion.questionName}</option>
						</c:forEach>
					</select>
				</div>
				<span class="help-inline" ><font color="red">*</font> </span>
				<input id="btnQuestion" class="btn btn-primary" type="button" value="确认选择" style="margin-top: 10%;" onclick="return confirmQuestion()"/>
			</div>
		</div>

			<%--多选题--%>

			<div class="control-group">
				<label class="control-label">题目类型：</label>
				<div class="controls">
					<select id="questionType1" name="questionType1" class="input-xlarge required" disabled="true"  >
						<c:forEach var="attribute" items="${fns:getDictList('resource_question_type')}">
							<option value="${fns:getDictValue(attribute,'resource_question_type',"")}" <c:if test="${fns:getDictValue(attribute,'resource_question_type','')==1}">selected</c:if>>${attribute}</option>
						</c:forEach>
					</select>
						<%--<input id="questionType1" type="text" name="questionType1" value="1" htmlEscape="false" maxlength="64" class="input-xlarge required"/>--%>
					<label id="scoreLabel1">分值：</label>
					<input id="score1" type="number" name="score1" htmlEscape="false" maxlength="64" class="input-xlarge " value ="${checkScore.score}" />
					<span id="span2" class="help-inline"><font  color="red">*</font> </span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">选择题目：</label>
				<div class="controls">
					<div class="container"></div>
					<div class="col-lg-10 col-md-9 col-sm-9 col-xs-12" >
						<select  multiple="multiple" size="10" id="checkboxDuallist" name="checkboxDuallist" class="resetDuallist">
							<c:forEach var="resourceQuestion" items="${resourceQuestionCheckboxs}" varStatus="status">
								<option value="${resourceQuestion.id}" <c:if test="${resourceQuestion.isChoose=='true'}">selected</c:if>>${resourceQuestion.questionName}</option>
							</c:forEach>
						</select>
					</div>
					<span class="help-inline" ><font color="red">*</font> </span>
					<input id="btnQuestion1" class="btn btn-primary" type="button" value="确认选择" style="margin-top: 10%;" onclick="return confirmQuestion1()"/>
				</div>
			</div>

			<%--判断题--%>
				<div class="control-group">
					<label class="control-label">题目类型：</label>
					<div class="controls">
						<select  id="questionType2" name="questionType2" class="input-xlarge required"  disabled="true">
							<c:forEach var="attribute" items="${fns:getDictList('resource_question_type')}">
								<option value="${fns:getDictValue(attribute,'resource_question_type',"")}" <c:if test="${fns:getDictValue(attribute,'resource_question_type','')==2}">selected</c:if>>${attribute}</option>
							</c:forEach>
						</select>
						<label id="scoreLabel2">分值：</label>
						<input id="score2" type="number" name="score2" htmlEscape="false" maxlength="64" class="input-xlarge" value ="${judgeScore.score}"/>
						<span id="span3" class="help-inline"><font  color="red">*</font> </span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">选择题目：</label>
					<div class="controls">
						<div class="container"></div>
						<div class="col-lg-10 col-md-9 col-sm-9 col-xs-12" >
							<select  multiple="multiple" size="10" id="judementDuallist" name="judementDuallist" class="resetDuallist">
								<c:forEach var="resourceQuestion" items="${resourceQuestionJudements}" varStatus="status">
									<option value="${resourceQuestion.id}" <c:if test="${resourceQuestion.isChoose=='true'}">selected</c:if>>${resourceQuestion.questionName}</option>
								</c:forEach>
							</select>
						</div>
						<span class="help-inline" ><font color="red">*</font> </span>
						<input id="btnQuestion2" class="btn btn-primary" type="button" value="确认选择" style="margin-top: 10%;" onclick="return confirmQuestion2()"/>
					</div>
				</div>


				<%--简答题--%>


				<div class="control-group">
					<label class="control-label">题目类型：</label>
					<div class="controls">
						<select id="questionType3" name="questionType3" class="input-xlarge required" disabled="true" >
							<c:forEach var="attribute" items="${fns:getDictList('resource_question_type')}">
								<option value="${fns:getDictValue(attribute,'resource_question_type',"")}" <c:if test="${fns:getDictValue(attribute,'resource_question_type','')==3}">selected</c:if>>${attribute}</option>
							</c:forEach>
						</select>
						<label id="scoreLabel3">分值：</label>
						<input id="score3" type="number" name="score3" htmlEscape="false" maxlength="64" class="input-xlarge" value ="${shortAnswerScore.score}" />
						<span id="span4" class="help-inline"><font  color="red">*</font> </span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">选择题目：</label>
					<div class="controls">
						<div class="container"></div>
						<div class="col-lg-10 col-md-9 col-sm-9 col-xs-12" >
							<select  multiple="multiple" size="10" id="shortAnswerDuallist" name="shortAnswerDuallist" class="resetDuallist">
								<c:forEach var="resourceQuestion" items="${resourceQuestionShortAnswers}" varStatus="status">
									<option value="${resourceQuestion.id}" <c:if test="${resourceQuestion.isChoose=='true'}">selected</c:if>>${resourceQuestion.questionName}</option>
								</c:forEach>
							</select>
						</div>
						<span class="help-inline" ><font color="red">*</font> </span>
						<input id="btnQuestion3" class="btn btn-primary" type="button" value="确认选择" style="margin-top: 10%;" onclick="return confirmQuestion3()"/>
					</div>
				</div>



				<div class="control-group">
			<div class="controls">
				<table id="contentTable" class="table table-striped table-bordered table-condensed">
					<thead>
					<tr>
						<th hidden>下发id</th>
						<th>题目名称</th>
						<th>题目类型</th>
						<th>分值</th>
						<%--<shiro:hasPermission name="teach:teachDistribute:edit"><th>配置</th></shiro:hasPermission>--%>
					</tr>
					</thead>
					<tbody id="questionBody"></tbody>
					<tbody id="questionBody1"></tbody>
					<tbody id="questionBody2"></tbody>
					<tbody id="questionBody3"></tbody>
				</table>
			</div>
		</div>
		</div>





		<%--随机题目--%>


		<div id="random"  hidden>
			<div class="control-group">
				<label class="control-label">题库选择：</label>
				<div class="controls">
					<select id="repertoryId" name="repertoryId" class="input-xlarge">
						<c:forEach items="${resourceRepertoryList}" var="Repertory" >
						<option value="${Repertory.id}"<c:if test="${Repertory.id==resourceRepertory.id}"> selected</c:if>>${Repertory.repertoryName}</option>

						</c:forEach>

					</select>
					<span class="help-inline"><font color="red">*</font> </span>
				</div>
			</div>
			<div class="control-group">
			<table class="controls" border="0">
				<tr class="control-group">
					<div class="controls">
					<td><input type="checkbox" id="radio_options" name="radio_options" value="0" />单选</td>
					<td>
						<label class="control-label">题目难度：</label>
							<select name="radio_difficulty" id="radio_difficulty" class="input-xlarge required">
								<%--<options items="${fns:getDictList('resource_question_difficulty')}" itemLabel="label" itemValue="value" htmlEscape="false"/>--%>
								<option value="0" >初级</option>
								<option value="1">中级</option>
								<option value="2">高级</option>
							</select>
							<span class="help-inline"><font color="red">*</font> </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					</td>

						<td><label id="radio_scoreLabel">分值：</label><input onchange="scoree('radio')" id="radio_score"
																		   type="text" name="radioScore"
																		   htmlEscape="false" maxlength="24"
																		   class="input-xlarge required"/>
						<span id="radio_span1" class="help-inline"><font  color="red">*</font> </span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
					<td><label id="radio_countNumberLabel">题目数量：</label><input  onchange="Search('0','radio')" id="radio_countNumber" type="text" name="radio_countNumber" htmlEscape="false" maxlength="24" class="input-xlarge required"/>
						<span id="radio_span2" class="help-inline"><font color="red">*</font> </span></td>
					</div>
				</tr>

				<tr class="control-group">
					<td><input type="checkbox"id="checkbox_options" name="checkbox_options" value="1" />多选</td>
					<td><label class="control-label">题目难度：</label>
						<select  id="checkbox_difficulty" name="checkbox_difficulty" class="input-xlarge required">
							<option value="0">初级</option>
							<option value="1">中级</option>
							<option value="2">高级</option>
						</select>
						<span class="help-inline"><font color="red">*</font> </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					</td>
					<td><label id="checkbox_scoreLabel">分值：</label><input onchange="scoree('checkbox')"
																		  id="checkbox_score" type="text"
																		  name="checkboxScore" htmlEscape="false"
																		  minlength="1" maxlength="64"
																		  class="input-xlarge required"/>
						<span id="checkbox_span1" class="help-inline"><font color="red">*</font> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
					</td>
					<td><label id="checkbox_countNumberLabel">题目数量：</label><input onchange="Search('1','checkbox')" id="checkbox_countNumber" type="text" name="checkbox_countNumber" htmlEscape="false" minlength="1" maxlength="64" class="input-xlarge required"/>
						<span id="checkbox_span2" class="help-inline"><font color="red">*</font> </span>
					</td>
				</tr>

				<tr class="control-group">
					<td><input type="checkbox" id="judement_options" name="Judement_options" value="2" />判断</td>
					<td><label class="control-label">题目难度：</label>
						<select id="judement_difficulty" name="judement_difficulty" class="input-xlarge required">
								<%--<options items="${fns:getDictList('resource_question_difficulty')}" itemLabel="label" itemValue="value" htmlEscape="false"/>--%>
							<option value="0">初级</option>
							<option value="1">中级</option>
							<option value="2">高级</option>
						</select>
						<span class="help-inline"><font color="red">*</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
					</td>
					<td><label id="judement_scoreLabel">分值：</label><input onchange="scoree('judement')"
																		  id="judement_score" type="text"
																		  name="judementScore" htmlEscape="false"
																		  maxlength="64" class="input-xlarge required"/>
						<span id="judement_span1"  class="help-inline"><font color="red">*</font> </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
					<td><label id="judement_countNumberLabel">题目数量：</label><input onchange="Search('2','judement')" id="judement_countNumber" type="text" name="judement_countNumber" htmlEscape="false" maxlength="64" class="input-xlarge required"/>
						<span id="judement_span2" class="help-inline"><font color="red">*</font> </span></td>
				</tr>

				<tr class="control-group">
					<td><input type="checkbox" name="ShortAnswer_options" id="shortAnswer_options" value="3" />简答</td>
					<td><label class="control-label">题目难度：</label>
						<select name="ShortAnswer_difficulty" id="shortAnswer_difficulty" class="input-xlarge required">
								<%--<options items="${fns:getDictList('resource_question_difficulty')}" itemLabel="label" itemValue="value" htmlEscape="false"/>--%>
							<option value="0">初级</option>
							<option value="1">中级</option>
							<option value="2">高级</option>
						</select>
						<span class="help-inline"><font color="red">*</font> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>

					</td>
					<td><label id="scoreLabel4">分值：</label><input onchange="scoree('shortAnswer')"
																  id="shortAnswer_score" type="text"
																  name="shortAnswerScore" htmlEscape="false"
																  maxlength="64" class="input-xlarge required"/>
						<span id="shortAnswer_span1" class="help-inline"><font color="red">*</font> </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
					<td><label id="countNumberLabel3">题目数量：</label><input onchange="Search('3','shortAnswer')" id="shortAnswer_countNumber" type="text" name="shortAnswer_countNumber" htmlEscape="false" maxlength="64" class="input-xlarge required"/>
						<span id="shortAnswer_span2" class="help-inline"><font color="red">*</font> </span></td>
				</tr>
			</table>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">备注：</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge "/>
			</div>

		</div>
		<div class="form-actions">
			<shiro:hasPermission name="resource:resourcePaper:edit"><input  id="btnSubmit" class="btn btn-primary" type="submit" value="保 存" onclick=" return checkValidate()"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
	<script>
//		var demo1 = $('select[name="duallist"]').bootstrapDualListbox();
//		$("#demoform").submit(function() {
//			alert($('[name="duallist"]').val());
//			return false;
//		});
		var demo1 = $('select[class="resetDuallist"]').bootstrapDualListbox({infoTextFiltered: '<span class="label label-purple label-lg">Filtered</span>'});
		$("#demoform").submit(function() {
			alert($('[class="resetDuallist"]').val());
			return false;
		});
		var demo1 = $('select[class="resetDuallist1"]').bootstrapDualListbox({infoTextFiltered: '<span class="label label-purple label-lg">Filtered</span>'});
		$("#demoform").submit(function() {
			alert($('[class="resetDuallist1"]').val());
			return false;
			});
	</script>

</body>
</html>